#include "pollServer.hpp"
#include "err.hpp"

#include <iostream>
#include <memory>
#include <unistd.h>

using namespace std;

string transaction(const string &request)
{
    return request;
}

static void Usage(string str)
{
    cout << "请输入：" << str << " " << "local_port" << endl;
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }

    unique_ptr<Server> ssvr(new Server(atoi(argv[1]), transaction));
    ssvr->initServer();
    ssvr->start();
    while (1)
    {
        sleep(1);
    }

    return 0;
}